package cn.tedu.spring.di;

import cn.tedu.spring.di.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Value("小红帽")
    private String serviceName;
    /**
     Autowired 注解 自动装配注解，注入对象类型和接口类型  Autowired 自动装配对象和接口类型的数据
     Autowired 只能注入接口和对象类型
     */
    @Autowired
    private UserDao userDao;
    private Integer casse;

    @Autowired
    public void setUserDao(UserDao userDao){
        this.userDao=userDao;
    }
    @Autowired
    public UserService(UserDao userDao){
        this.userDao=userDao;
    }


    @Override
    public String toString() {
        return "UserService{" +
                "serviceName='" + serviceName + '\'' +
                ", userDao=" + userDao +
                '}';
    }
}
